package com.woniuxy04;

/**
 * @author 作者
 * @create 2025-06-05 16:23
 */
public class Test07 {
    public static void main(String[] args) {
//        try {
//            System.out.println(convert01("123abefefe"));
//        } catch (Exception e) {
//            throw new RuntimeException(e);
////            System.out.println("无法转换");
//        }
        try {
            xxx("123aaa");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        System.out.println("over");
    }


    public static  int xxx(String str){
        try {
            return convert01(str);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static int convert01(String s){
        if(s.matches("\\d+")){
            return 123;
        }else{
            //抛出异常,抛给方法调用者
            throw new RuntimeException("无效数字，无法转换");
        }
    }

}
